********************************************************************
****** Replication code for Rebel Funding and Child Soldiers********
********************************************************************
********************** Made with Stata 14 **************************
********************************************************************
****************** Dataset: Replication_Forced *********************



**Variables:
* forceindex: level of forced recruitment by rebel groups per year
* region: this variable indicates on which continent the rebel group was active
* nr_anystrategy_lag: natural resource exploitation by rebel groups per year (lagged with one year) based on the RCD (Walsh et al. 2018) 
* lootable1_lag: lootable resource extraction by rebel groups per year (lagged with one year) based on the RCD (Walsh et al. 2018)
* nonlootableonly1_lag: resource extraction other than lootable resources by rebel groups (lagged with one year) based on RCD (Walsh et al. 2018)
* rebsupport1: foreign support of rebel groups by governments of a foreign state. This is based on NSA data of Cunninghame et al. 2009;2013).
* duration: the number of years a rebel group is active. This is based on NSA data of Cunningham et al. 2009;2013).
* effcontrol: Effective territorial control by rebel groups. This is based on NSA data of Cunningham et al. 2009;2013).
* strengthcontrol: The extent to which a central command excercises control of the constituent groups of an insurgent movement. This is based on NSA data of Cunningham et al. 2009;2013).
* polwing1: does the insurgent group has a political wing. This is based on NSA data of Cunningham et al. 2009;2013).
* forcedgov: did the government (national army and other government institutions, such as the police) forcible recruit children or not?
* polity2: level of democracy. Based on Polity IV dataset (Marshall and Jaggers 2004).
* bdeaths: logged number of battle-related deaths. Coming from the World Development Indicators.
* lnGLEDrgdppc: logged real GDP per capita from Gleditsch (2002).
* lnWDI_pop014: logged version of the youth population indicator of the World Development Indicators. 
* Csdum: did the rebel group recruited children or not? Based on the CSDS dataset Haer and Boehmelt 2018.
* Forcedum: a dichtomous variable that indicates whether or not the rebel groups foricbly recruited children.
* dyadid: identification for conflict dyad. This is based on NSA data of Cunningham et al. (2009; 2013). 
* id: id no. of conflict period. This is based on NSA data of Cunningham et al. (2009; 2013).
* post1989: Group formed post 1989. This is based on NSA data of Cunningham et al. (2009; 2013).
* duration2: Group is active for at least 2 years. This is based on NSA data of Cunningham et al. (2009; 2013).
* polity22: Polity2 score squared. Based on Polity IV dataset (Marshall and Jaggers 2004).
* duration3: Conflict duration (not whetehr a group is active and for how long). This is based on NSA data of Cunningham et al. (2009; 2013).
* Csindex: Child soldier index (0-2). Based on the CSDS dataset Haer and Boehmelt 2018.


***  TABLES MANUSCRIPT
** Table 1: Distribution of forced recruitment in rebel group-government conflict dyady-years
sum forceindex

** Table 2: Descriptive statistics
sum forceindex nr_anystrategy_lag lootable1_lag rebsupport1 duration effcontrol strengthcontrol polwing1 forcedgov polity2 bdeaths lnGLEDrgdppc lnWDI_pop014

** Table 3: Determinants of forced recruitment off children by rebel groups
ologit forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
keep if e(sample)
* note: we take the observations of model 2 as a baseline (696 observations)
ologit forceindex rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
ologit forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
ologit forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov if Csdum==1, cluster(dyadid)
collapse (max) forceindex nr_anystrategy_lag lootable1_lag rebsupport1 strengthcontrol effcontrol polwing1 forcedgov (mean) duration  polity2 bdeaths lnGLEDrgdppc lnWDI_pop014, by(id)
* note: collapse over all observations!
ologit forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov

** Table 4: The influence of "lootability" on the forcible recruitment of children
ologit forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
keep if e(sample)
* note: we take the observations of model 2 as a baseline (696 observations)
ologit forceindex lootable1_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
ologit forceindex nonlootableonly1_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
ologit forceindex lootable1_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov if Csdum==1, cluster(dyadid)
collapse (max) forceindex nr_anystrategy_lag lootable1_lag rebsupport1 strengthcontrol effcontrol polwing1 forcedgov (mean) duration  polity2 bdeaths lnGLEDrgdppc lnWDI_pop014, by(id)
* note: collapse over all observations!
ologit forceindex lootable1_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov



***   FIGURES MANUSCRIPT
** Figure 1: Distribution of forcible recruitment of chidlren by rebel groups across regions
histogram forceindex, discrete addlabel ylabel(,grid) xlabel(0(1)2) by(region, total) gap(40)

** Figure 2: Substantive impact on (dichotomous) Forced Recruitment of Children
estsimp logit forcedum nr_anystrategy_lag rebsupport1 duration forcedgov effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1, cluster(dyadid) level(90)
setx nr_anystrategy_lag median rebsupport1 median duration median forcedgov median effcontrol median polity2 median bdeaths median lnGLEDrgdppc median lnWDI_pop014 median strengthcontrol median polwing1 median
simqi, fd(prval(1)) changex(nr_anystrategy_lag min max) level(90)
simqi, fd(prval(1)) changex(rebsupport1 min max) level(90)
simqi, fd(prval(1)) changex(duration min max) level(90)
simqi, fd(prval(1)) changex(forcedgov min max) level(90)
simqi, fd(prval(1)) changex(effcontrol min max) level(90)
simqi, fd(prval(1)) changex(polity2 min max) level(90)
simqi, fd(prval(1)) changex(bdeaths min max) level(90)
simqi, fd(prval(1)) changex(lnGLEDrgdppc min max) level(90)
simqi, fd(prval(1)) changex(lnWDI_pop014 min max) level(90)
simqi, fd(prval(1)) changex(strengthcontrol min max) level(90)
simqi, fd(prval(1)) changex(polwing1 min max) level(90)
drop b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12
* note: FD figure made with R
* note: because these are simulations, the exact coefficients might differ slightely each time you run it.

** Figure 3: Substantive impact on (dichotomous) Forced Recruitment of Children
estsimp logit forcedum lootable1_lag rebsupport1 duration forcedgov effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1, cluster(dyadid) level(90)
setx lootable1_lag median rebsupport1 median duration median forcedgov median effcontrol median polity2 median bdeaths median lnGLEDrgdppc median lnWDI_pop014 median strengthcontrol median polwing1 median
simqi, fd(prval(1)) changex(lootable1_lag min max) level(90)
simqi, fd(prval(1)) changex(rebsupport1 min max) level(90)
simqi, fd(prval(1)) changex(duration min max) level(90)
simqi, fd(prval(1)) changex(forcedgov min max) level(90)
simqi, fd(prval(1)) changex(effcontrol min max) level(90)
simqi, fd(prval(1)) changex(polity2 min max) level(90)
simqi, fd(prval(1)) changex(bdeaths min max) level(90)
simqi, fd(prval(1)) changex(lnGLEDrgdppc min max) level(90)
simqi, fd(prval(1)) changex(lnWDI_pop014 min max) level(90)
simqi, fd(prval(1)) changex(strengthcontrol min max) level(90)
simqi, fd(prval(1)) changex(polwing1 min max) level(90)
drop b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12
* note: FD figure made with R
* note: because these are simulations, the exact coefficients might differ slightely each time you run it.



***  APPENDIX
** Table A1: Supply versus demand factors
ologit forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
keep if e(sample)
* note: we take the observations of model 2 as a baseline (696 observations)
ologit forceindex effcontrol polity2 lnGLEDrgdppc lnWDI_pop014, cluster(dyadid)
ologit forceindex nr_anystrategy_lag rebsupport1 duration bdeaths strengthcontrol polwing1 forcedgov effcontrol, cluster(dyadid)
ologit forceindex nr_anystrategy_lag rebsupport1 duration bdeaths strengthcontrol polwing1 forcedgov effcontrol polity2 lnGLEDrgdppc lnWDI_pop014, cluster(dyadid)

** Table A2: Models with different numbers of observations
ologit forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
ologit forceindex lootable1_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
ologit forceindex nonlootableonly1_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)

** Table A3: Variance Inflation Factors
ologit forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
keep if e(sample)
collin forceindex rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov
collin forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov
collin forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov if Csdum==1
collin forceindex lootable1_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov
collin forceindex nonlootableonly1_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov
collin forceindex lootable1_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov if Csdum==1
collapse (max) forceindex nr_anystrategy_lag lootable1_lag rebsupport1 strengthcontrol effcontrol polwing1 forcedgov (mean) duration  polity2 bdeaths lnGLEDrgdppc lnWDI_pop014, by(id)
collin forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov
collin forceindex lootable1_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov

** Table A4: Forcible recruitment as a ichotomous variable
ologit forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
keep if e(sample)
* note: we take the observations of model 2 as a baseline (696 observations)
ologit forceindex nr_anystrategy_lag rebsupport1 duration bdeaths strengthcontrol polwing1 forcedgov effcontrol polity2 lnGLEDrgdppc lnWDI_pop014, cluster(dyadid)
logit forcedum nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
ologit forceindex lootable1_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
logit forcedum lootable1_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)

** Table A5: Descriptive statistics of cross-sectional variables collapsed over conflict period
collapse (max) forceindex nr_anystrategy_lag lootable1_lag rebsupport1 strengthcontrol effcontrol polwing1 forcedgov (mean) duration  polity2 bdeaths lnGLEDrgdppc lnWDI_pop014, by(id)
sum forceindex nr_anystrategy_lag lootable1_lag rebsupport1 duration effcontrol strengthcontrol polwing1 forcedgov polity2 bdeaths lnGLEDrgdppc lnWDI_pop014

** Table A6: Descriptive statistics of cross-sectional variables collapsed over rebel group
collapse (max) forceindex nr_anystrategy_lag lootable1_lag rebsupport1 strengthcontrol effcontrol polwing1 forcedgov (mean) duration  polity2 bdeaths lnGLEDrgdppc lnWDI_pop014, by(dyadid)
sum forceindex nr_anystrategy_lag lootable1_lag rebsupport1 duration effcontrol strengthcontrol polwing1 forcedgov polity2 bdeaths lnGLEDrgdppc lnWDI_pop014

** Table A7: Cross-sectional analyses
collapse (max) forceindex nr_anystrategy_lag lootable1_lag rebsupport1 strengthcontrol effcontrol polwing1 forcedgov (mean) duration  polity2 bdeaths lnGLEDrgdppc lnWDI_pop014, by(id)
ologit forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov
ologit forceindex lootable1_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov
collapse (max) forceindex nr_anystrategy_lag lootable1_lag rebsupport1 strengthcontrol effcontrol polwing1 forcedgov (mean) duration  polity2 bdeaths lnGLEDrgdppc lnWDI_pop014, by(dyadid)
ologit forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov
ologit forceindex lootable1_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov

** Table A8: Bivariate models
* note: upcoming analyses are all over full dataset (not collapsed)
ologit forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
keep if e(sample)
ologit forceindex nr_anystrategy_lag, cluster(dyadid)
ologit forceindex lootable1_lag, cluster(dyadid)

** Table A9: Replication of Beber and Blattman (2013) models
g post1989 =0
replace post1989 = 1 if startyear>1989
lab var post1989 "group formed post 1989"
g duration2 = duration
la var duration2 "Active for at least 2 years"
recode duration2 (3/42=1) (1/2=0)
ologit forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
keep if e(sample)
ologit forceindex nr_anystrategy_lag rebsupport1 duration2 post1989 post1989#rebsupport1, cluster(dyadid)
ologit forceindex lootable1_lag rebsupport1 duration2 post1989 post1989#rebsupport1, cluster(dyadid)

** Table A10: Models with curvilnear effect of democracy
g polity22 = (polity2^2)
ologit forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 polity22 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
ologit forceindex lootable1_lag rebsupport1 duration effcontrol polity2 polity22 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)

** Table A11: Different measures of conflict duration
bysort ucdpid: gen duration3=_N
label var duration3 "conflict duration"
ologit forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
keep if e(sample)
ologit forceindex nr_anystrategy_lag rebsupport1 duration3 effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
ologit forceindex lootable1_lag rebsupport1 duration3 effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)

** Table A12: Ordered logit models with all independent variables lagged
xtset dyadid year, yearly
g rebsupport1_lag = l.rebsupport1
lab var rebsupport1_lag "Foreign support lagged with 1 year"
g duration_lag = l.duration
lab var duration_lag "duration lagged with 1 year"
g effcontrol_lag = l.effcontrol
lab var effcontrol_lag "Effective territorial control lagged with 1 year"
g polity2_lag = l.polity2
lab var polity2_lag "Democracy lagged with 1 year"
g bdeaths_lag = l.bdeaths
lab var bdeaths_lag "Battle deaths lagged with 1 year"
g lnGLEDrgdppc_lag = l.lnGLEDrgdppc
lab variable lnGLEDrgdppc_lag "GDP lagged with 1 year"
g lnWDI_pop014_lag = l.lnWDI_pop014
lab variable lnWDI_pop014_lag "Population youth lagged with 1 year"
g strengthcontrol_lag = l.strengthcontrol
lab variable strengthcontrol_lag "Central control with 1 year"
g polwing1_lag = l.polwing1
lab variable polwing1_lag "Political wing lagged with 1 year"
g forcedgov_lag = l.forcedgov
lab variable forcedgov_lag "Forced gov cs lagged with 1 year"
ologit forceindex nr_anystrategy_lag rebsupport1_lag duration_lag effcontrol_lag polity2_lag bdeaths_lag lnGLEDrgdppc_lag lnWDI_pop014_lag strengthcontrol_lag polwing1_lag forcedgov_lag, cluster(dyadid)
keep if e(sample)
ologit forceindex nr_anystrategy_lag rebsupport1_lag duration_lag effcontrol_lag polity2_lag bdeaths_lag lnGLEDrgdppc_lag lnWDI_pop014_lag strengthcontrol_lag polwing1_lag forcedgov_lag, cluster(dyadid)
ologit forceindex lootable1_lag  rebsupport1_lag duration_lag effcontrol_lag polity2_lag bdeaths_lag lnGLEDrgdppc_lag lnWDI_pop014_lag strengthcontrol_lag polwing1_lag forcedgov_lag, cluster(dyadid)

** Table A13: Full models with foreign support disentangled
* note: For this we merged it with the UCDP External support dataset with ours
* note: We made a seperate merged dataset (CSDS_RCD_UCDP External Support_Merge_12_19_2018.dta) for this because the observations changed significantly.E-mail the corresponding author for this dataset.
ologit forceindex nr_anystrategy_lag external_military duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
ologit forceindex nr_anystrategy_lag external_finance duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
ologit forceindex nr_anystrategy_lag external_territory duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)

** Table A14: Child soldier recruitment index versus forced recruitment index
tab Csindex forceindex

** Table A15: Determinants of forced recruitment of children by rebel groups 
ologit forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
ologit forceindex nr_anystrategy_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov if Csdum==1, cluster(dyadid)
ologit forceindex lootable1_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov, cluster(dyadid)
ologit forceindex lootable1_lag rebsupport1 duration effcontrol polity2 bdeaths lnGLEDrgdppc lnWDI_pop014 strengthcontrol polwing1 forcedgov if Csdum==1, cluster(dyadid)

